// 先传递一部分 参数 
let curry = function (fn) {
  let args = [];
  return  function next() {
    args = [...args, ...arguments]
    console.log(fn.length, args.length)
    if(fn.length <= args.length) {
      fn.apply(this, args)
    }else{
      return next
    }
  }
}

function sum(a,b,c) {
  console.log(a+b+c) 
}
// sum(1,2)(3)
let sum1 = curry(sum)
sum1(1,2)(3)